package com.iflytek.day26;

import java.io.FileOutputStream;
import java.io.IOException;

public class _04_FileOutputStreamDemo {
  public static void main(String[] args) {
    // 加入finally来实现释放资源
    FileOutputStream fos = null;
    try {
      fos = new FileOutputStream("src\\com\\iflytek\\day26\\fos.txt");
      fos.write("hello".getBytes());
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      if (fos != null) {
        try {
          fos.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
}
